import {Component} from '@angular/core';
import {HttpClient, HttpHeaders} from "@angular/common/http";

@Component({
  selector: 'app-user-register',
  templateUrl: './user-register.component.html',
  styleUrls: ['./user-register.component.css']
})
export class UserRegisterComponent {
  private url_register = "http://localhost:8080/user/register";

  constructor(public http: HttpClient) {}

  userInfo = {
    username: '',
    password: '',
    email: '',
    phone: ''
  }

  register() {
    this.http.post(this.url_register,
      this.userInfo, {headers: new HttpHeaders({'Content-Type': 'application/json'})})
      .subscribe((response: any) => {
        alert(response.message)
      })
  }
}
